package com.yunxi.controller.sto;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yunxi.core.web.ApiResult;
import com.yunxi.core.web.CurrentUser;
import com.yunxi.core.web.LoginInfo;
import com.yunxi.core.web.ResponseUtil;
import com.yunxi.sto.pojo.StoStockOutVO;
import com.yunxi.sto.service.StoStockOutDubboService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 车辆出库单 前端控制器
 * </p>
 *
 * @author caoYong
 * @since 2019-05-21
 */
@RestController
@RequestMapping("/admin/stoStockOut")
@Api(tags = "sto:stockOut", description = "车辆出库单接口")
public class StoStockOutController {
 private static final Logger logger = LoggerFactory.getLogger(StoStockOutController.class);

 @Autowired
 StoStockOutDubboService stoStockOutDubboService;

 @GetMapping("/page")
 @ApiOperation(value = "查询分页")
 public ApiResult page(StoStockOutVO stoStockOutVO, @RequestParam(required = true)Integer pageNum, @RequestParam(required = true)Integer pageSize) throws Exception {
  return ResponseUtil.ok(stoStockOutDubboService.findPageByVO(stoStockOutVO,pageNum,pageSize));
 }

 @GetMapping("/load")
 @ApiOperation(value = "读取单个")
 @ApiImplicitParam(paramType="query", name = "stockOutId", value = "主键id", required = true, dataType = "String")
 public ApiResult load(String stockOutId) throws Exception {
  return ResponseUtil.ok(stoStockOutDubboService.getById(stockOutId));
 }

 /*@PostMapping("/save")
 @ApiOperation(value = "保存信息")
 public ApiResult save(@RequestBody StoStockOutVO stoStockOutVO,@CurrentUser LoginInfo loginInfo) throws Exception {
    stoStockOutDubboService.saveOrUpdate(stoStockOutVO);
  return ResponseUtil.ok("success");
}

 @PostMapping("/del")
 @ApiOperation(value = "删除")
 public ApiResult del(@RequestBody StoStockOutVO stoStockOutVO) throws Exception {
    stoStockOutDubboService.removeById(stoStockOutVO.getId());
 return ResponseUtil.ok("success");
 }*/

/*@PostMapping("/export")
@ApiOperation(value = "导出excel")
public Object export(@RequestParam Map<String,Object> params) throws Exception {
return ResponseUtil.ok(stoStockOutDubboService.findMapByList(params));
}*/
}
